﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using System.Data;
using System.Data.SQLite;

public partial class BasicInfo_ModifyPass : UDCPage
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void submit_Click(object sender, EventArgs e)
    {
        string sqlstr = "update ud_user_t set password = :newpass where password = :oldpass and ifvalid = 1 " 
            + "and uid = :uid";
        SQLiteParameter[] spc = {
        new SQLiteParameter(":uid", DbType.Int32),
        new SQLiteParameter(":newpass", DbType.String, 40),
        new SQLiteParameter(":oldpass", DbType.String, 40)
        };
        spc[0].Value = Uid;
        spc[1].Value = NewPassword.Text.Trim();
        spc[2].Value = oldPassword.Text.Trim();
        int res = SQLiteHelper.ExecuteNonQuery(sqlstr, spc);
        if (res == 0)
        {
            msg.Text = "旧密码不正确！";
        }
        else         
        {
            msg.Text = "新密码已经设置成功！";
        }

    }
}